﻿

namespace Huirui.Cavan.Domain.MainBoundedContext.SystemModule
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Huirui.Cavan.Domain.MainBoundedContext.SearchModule;
    using Huirui.Cavan.Core.Persistent;
    using Huirui.Cavan.Domain.MainBoundedContext.StockModule;
    using Huirui.Cavan.Domain.MainBoundedContext.PurchaseModule;
    using Huirui.Cavan.Domain.MainBoundedContext.SalesModule;

    public class SpecificationFactory
    {
        public static AreaSpecification CreateAreaSpecification(AreaSearch searchParams)
        {
            AreaSpecification specification = new AreaSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static UserAccountSpecification CreateUserAccountSpecification(UserAccountSearch searchParams)
        {
            UserAccountSpecification specification = new UserAccountSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static AttachmentSpecification CreateAttachmentSpecification(AttachmentSearch searchParams)
        {
            AttachmentSpecification specification = new AttachmentSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static NoticeSpecification CreateNoticeSpecification(NoticeSearch searchParams)
        {
            NoticeSpecification specification = new NoticeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static EmployeeSpecification CreateEmployeeSpecification(EmployeeSearch searchParams)
        {
            EmployeeSpecification specification = new EmployeeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static AccountSpecification CreateAccountSpecification(AccountSearch searchParams)
        {
            AccountSpecification specification = new AccountSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static CurrencySpecification CreateCurrencySpecification(CurrencySearch searchParams)
        {
            CurrencySpecification specification = new CurrencySpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static BaseCodeRuleSpecification CreateBaseCodeRuleSpecification(BaseCodeRuleSearch searchParams)
        {
            BaseCodeRuleSpecification specification = new BaseCodeRuleSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        /// <summary>
        /// add 20130329
        /// </summary>
        /// <param name="searchParams"></param>
        /// <returns></returns>
        public static IndustryTypeSpecification CreateIndustryTypeSpecification(IndustryTypeSearch searchParams)
        {
            IndustryTypeSpecification specification = new IndustryTypeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static ReceiptCodeRuleSpecification CreateReceiptCodeRuleSpecification(ReceiptCodeRuleSearch searchParams)
        {
            ReceiptCodeRuleSpecification specification = new ReceiptCodeRuleSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SystemConfigSpecification CreateSystemConfigSpecification(SystemConfigSearch searchParams)
        {
            SystemConfigSpecification specification = new SystemConfigSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static DepartmentSpecification CreateDepartmentSpecification(DepartmentSearch searchParams)
        {
            DepartmentSpecification specification = new DepartmentSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static CodeRulePropertySpecification CreateCodeRulePropertySpecification(CodeRulePropertySearch searchParams)
        {
            CodeRulePropertySpecification specification = new CodeRulePropertySpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static ManualCodeHistorySpecification CreateManualCodeHistorySpecification(ManualCodeHistorySearch searchParams)
        {
            ManualCodeHistorySpecification specification = new ManualCodeHistorySpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SupplierTypeSpecification CreateSupplierTypeSpecification(SupplierTypeSearch searchParams)
        {
            SupplierTypeSpecification specification = new SupplierTypeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockTypeSpecification CreateStockTypeSpecification(StockTypeSearch searchParams)
        {
            StockTypeSpecification specification = new StockTypeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static WareHouseSpecification CreateWareHouseSpecification(WareHouseSearch searchParams)
        {
            WareHouseSpecification specification = new WareHouseSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }


        public static StockInOutSpecification CreateStockInOutSpecification(StockInOutSearch searchParams)
        {
            StockInOutSpecification specification = new StockInOutSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static UnPaySpecification CreateUnPaySpecification(UnPaySearch searchParams)
        {
            UnPaySpecification specification = new UnPaySpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockInDetailSpecification CreateStockInDetailSpecification(StockInOutDetailSearch searchParams)
        {
            StockInDetailSpecification specification = new StockInDetailSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockSpecification CreateStockSpecification(StockSearch searchParams)
        {
            StockSpecification specification = new StockSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static ReceivablesSpecification CreateReceivablesSpecification(ReceivablesSearch searchParams)
        {
            ReceivablesSpecification specification = new ReceivablesSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockInOutTypeSpecification CreateStockInOutTypeSpecification(StockInOutTypeSearch searchParams)
        {
            StockInOutTypeSpecification specification = new StockInOutTypeSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static UnitTransferSpecification CreateUnitTransferSpecification(UnitTransferSearch searchParams)
        {
            UnitTransferSpecification specification = new UnitTransferSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockUnitSpecification CreateStockUnitSpecification(StockUnitSearch searchParams)
        {
            StockUnitSpecification specification = new StockUnitSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SupplierSpecification CreateSupplierSpecification(SupplierSearch searchParams)
        {
            SupplierSpecification specification = new SupplierSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static CustomerSpecification CreateCustomerSpecification(CustomerSearch searchParams)
        {
            CustomerSpecification specification = new CustomerSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static JobSpecification CreateJobSpecification(JobSearch searchParams)
        {
            JobSpecification specification = new JobSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SysActionSpecification CreateSysActionSpecification(SysActionSearch searchParams)
        {
            SysActionSpecification specification = new SysActionSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SysControllerSpecification CreateSysControllerSpecification(SysControllerSearch searchParams)
        {
            SysControllerSpecification specification = new SysControllerSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static StockInitialBalanceSpecification CreateStockInitialBalanceSpecification(StockInitialBalanceSearch searchParams)
        {
            StockInitialBalanceSpecification specification = new StockInitialBalanceSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static PurchaseReturnSpecification CreatePurchaseReturnSpecification(PurchaseReturnSearch searchParams)
        {
            PurchaseReturnSpecification specification = new PurchaseReturnSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static SalesPriceSpecification CreateSalesPriceSpecification(SalesPriceSearch searchParams)
        {
            SalesPriceSpecification specification = new SalesPriceSpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static PaySpecification CreatePaySpecification(PaySearch searchParams)
        {
            PaySpecification specification = new PaySpecification();
            specification.SearchParams = searchParams;

            return specification;
        }

        public static ISpecification CreateSpecification<T, TSearch>(TSearch searchParams)
        {
            if (searchParams is AreaSearch)
            {
                return SpecificationFactory.CreateAreaSpecification(searchParams as AreaSearch);
            }
            else if (searchParams is UserAccountSearch)
            {
                return SpecificationFactory.CreateUserAccountSpecification(searchParams as UserAccountSearch);
            }
            else if (searchParams is AttachmentSearch)
            {
                return SpecificationFactory.CreateAttachmentSpecification(searchParams as AttachmentSearch);
            }
            else if (searchParams is NoticeSearch)
            {
                return SpecificationFactory.CreateNoticeSpecification(searchParams as NoticeSearch);
            }
            else if (searchParams is EmployeeSearch)
            {
                return SpecificationFactory.CreateEmployeeSpecification(searchParams as EmployeeSearch);
            }
            else if (searchParams is AccountSearch)
            {
                return SpecificationFactory.CreateAccountSpecification(searchParams as AccountSearch);
            }
            else if (searchParams is CurrencySearch)
            {
                return SpecificationFactory.CreateCurrencySpecification(searchParams as CurrencySearch);
            }
            else if (searchParams is BaseCodeRuleSearch)
            {
                return SpecificationFactory.CreateBaseCodeRuleSpecification(searchParams as BaseCodeRuleSearch);
            }
            else if (searchParams is IndustryTypeSearch)
            {
                return SpecificationFactory.CreateIndustryTypeSpecification(searchParams as IndustryTypeSearch);
            }
            else if (searchParams is ReceiptCodeRuleSearch)
            {
                return SpecificationFactory.CreateReceiptCodeRuleSpecification(searchParams as ReceiptCodeRuleSearch);
            }
            else if (searchParams is SystemConfigSearch)
            {
                return SpecificationFactory.CreateSystemConfigSpecification(searchParams as SystemConfigSearch);
            }
            else if (searchParams is DepartmentSearch)
            {
                return SpecificationFactory.CreateDepartmentSpecification(searchParams as DepartmentSearch);
            }
            else if (searchParams is CodeRulePropertySearch)
            {
                return SpecificationFactory.CreateCodeRulePropertySpecification(searchParams as CodeRulePropertySearch);
            }
            else if (searchParams is ManualCodeHistorySearch)
            {
                return SpecificationFactory.CreateManualCodeHistorySpecification(searchParams as ManualCodeHistorySearch);
            }
            else if (searchParams is SupplierTypeSearch)
            {
                return SpecificationFactory.CreateSupplierTypeSpecification(searchParams as SupplierTypeSearch);
            }
            else if (searchParams is StockTypeSearch)
            {
                return SpecificationFactory.CreateStockTypeSpecification(searchParams as StockTypeSearch);
            }
            else if (searchParams is WareHouseSearch)
            {
                return SpecificationFactory.CreateWareHouseSpecification(searchParams as WareHouseSearch);
            }
            else if (searchParams is StockInOutSearch)
            {
                return SpecificationFactory.CreateStockInOutSpecification(searchParams as StockInOutSearch);
            }
            else if (searchParams is UnPaySearch)
            {
                return SpecificationFactory.CreateUnPaySpecification(searchParams as UnPaySearch);
            }
            else if (searchParams is StockInOutDetailSearch)
            {
                return SpecificationFactory.CreateStockInDetailSpecification(searchParams as StockInOutDetailSearch);
            }
            else if (searchParams is StockSearch)
            {
                return SpecificationFactory.CreateStockSpecification(searchParams as StockSearch);
            }
            else if (searchParams is ReceivablesSearch)
            {
                return SpecificationFactory.CreateReceivablesSpecification(searchParams as ReceivablesSearch);
            }
            else if (searchParams is StockInOutTypeSearch)
            {
                return SpecificationFactory.CreateStockInOutTypeSpecification(searchParams as StockInOutTypeSearch);
            }
            else if (searchParams is UnitTransferSearch)
            {
                return SpecificationFactory.CreateUnitTransferSpecification(searchParams as UnitTransferSearch);
            }
            else if (searchParams is StockUnitSearch)
            {
                return SpecificationFactory.CreateStockUnitSpecification(searchParams as StockUnitSearch);
            }
            else if (searchParams is SupplierSearch)
            {
                return SpecificationFactory.CreateSupplierSpecification(searchParams as SupplierSearch);
            }
            else if (searchParams is CustomerSearch)
            {
                return SpecificationFactory.CreateCustomerSpecification(searchParams as CustomerSearch);
            }
            else if (searchParams is JobSearch)
            {
                return SpecificationFactory.CreateJobSpecification(searchParams as JobSearch);
            }
            else if (searchParams is SysActionSearch)
            {
                return SpecificationFactory.CreateSysActionSpecification(searchParams as SysActionSearch);
            }
            else if (searchParams is SysControllerSearch)
            {
                return SpecificationFactory.CreateSysControllerSpecification(searchParams as SysControllerSearch);
            }
            else if (searchParams is StockInitialBalanceSearch)
            {
                return SpecificationFactory.CreateStockInitialBalanceSpecification(searchParams as StockInitialBalanceSearch);
            }
            else if (searchParams is PurchaseReturnSearch)
            {
                return SpecificationFactory.CreatePurchaseReturnSpecification(searchParams as PurchaseReturnSearch);
            }
            else if (searchParams is SalesPriceSearch)
            {
                return SpecificationFactory.CreateSalesPriceSpecification(searchParams as SalesPriceSearch);
            }
            else if (searchParams is PaySearch)
            {
                return SpecificationFactory.CreatePaySpecification(searchParams as PaySearch);
            }
            return null;
        }
    }
}
